package com.example.bus.ui.way;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import com.example.bus.databinding.FragmentWayBinding;

public class WayFragment extends Fragment {

    private FragmentWayBinding wayBinding;

    public View onCreateView(@NonNull LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {
        WayViewModel wayViewModel =
                new ViewModelProvider(this).get(WayViewModel.class);

        wayBinding = FragmentWayBinding.inflate(inflater, container, false);
        View root = wayBinding.getRoot();

        final TextView textView = wayBinding.textNotifications;
        wayViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
        return root;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        wayBinding = null;
    }
}